<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <h2>条件渲染</h2>
      <!-- v-else和v-else-if必须要紧挨着v-if -->
      <p v-if="show">Vue is awesome!</p>
      <p v-else>Oh no 😢</p>

      <hr />

      <p v-if="sex === 1">男</p>
      <p v-else-if="sex === 2">女</p>
      <p v-else>未知</p>

      <hr />

      <!-- template是vue提供的标签(组件) -->
      <!-- 作用：用于占位的空标签, 一般用于判断和循环 -->
      <template v-if="show2">
        <p>name: pengshao</p>
        <p>age: 20</p>
        <p>age: 20</p>
        <p>age: 20</p>
        <p>age: 20</p>
        <p>age: 20</p>
        <p>age: 20</p>
      </template>
    </div>

    <script src="./lib/vue3.js"></script>
    <script>
      const { createApp } = Vue;

      createApp({
        data() {
          return {
            show: false,
            sex: 6,

            show2: true,
          };
        },
      }).mount("#app");
    </script>
  </body>
</html>
